package zy1208.zy23;

import java.io.FileWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

public class demo {
    public static void main(String[] args) throws Exception{
        HashMap<String, String> map = new HashMap<String, String>();
        map.put("pid","10");
        map.put("name","张三");
        map.put("age","18");
        String str="";
        Properties prop = new Properties();
        for (Map.Entry<String, String> x : map.entrySet()) {
            str+=x.getKey()+"="+x.getValue()+"\n";
        }
        FileWriter out = new FileWriter("mapdata.properties");
        prop.store(out,str);
    }
}
